package com.gopay.common.core.dic.dao.impl;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.core.dic.dao.DicTransTypeDAO;
import com.gopay.common.domain.dic.DicTransType;

/**
 * 交易类型字段表dao
 * @DicTransTypeDAOImpl.java
 * @author liujy
 * @2013-4-8 下午2:31:23  www.gopay.com.cn Inc.All rights reserved.
 */
@Repository("dicTransTypeDAO")
public class DicTransTypeDAOImpl extends BaseDAOImpl<DicTransType, Serializable> implements DicTransTypeDAO{

    @Override
    public DicTransType findByIntTxnCd(String gopayIntTxnCd) {
        
        String hql = "from DicTransType where code=:gopayIntTxnCd";
        Map<String, Object> param = new HashMap<String, Object>();
        param.put("gopayIntTxnCd", gopayIntTxnCd);
        
        List<DicTransType> list = findByHql(hql, param);
        if(list == null || list.isEmpty()){
            return null;
        }
        
        return list.get(0);
    }

    @Override
    public List<DicTransType> findAllTransType() {
        return findAll(DicTransType.class);
    }
}